<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script>
var ws = new WebSocket("ws://localhost:8888/EchoServer/echo");

ws.onclose = function(event) {
	alert("websocket " + event + " is closed");
};

ws.onopen = function(event) {
	alert("websocket " + event + " is opened");
};

ws.onmessage = function(event) {
	var chatarea = document.getElementById("chatarea");
	chatarea.value = chatarea.value + "\n" + event.data;
};



	function send() {
		var msg = document.getElementById("msg");
		ws.send(msg.value);
		msg.value = '';
		return false;
	}
</script>
</head>
<body>
<p>
<textarea id="chatarea" rows="30" cols="70"></textarea>
<br />
<input type="text" id="msg" size="30" /><button type="button" onclick="send();">send</button>
</p>
</body>
</html>